package cn.dt67.service.impl;

import cn.dt67.dao.role.RoleMapper;
import cn.dt67.pojo.Role;
import cn.dt67.service.RoleService;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service("roleService")
public class RoleServiceImpl implements RoleService {

    private static final Logger logger = Logger.getLogger(RoleServiceImpl.class);
    @Resource
    private RoleMapper roleMapper;

    //@Override
    public List<Role> findAll() {
        List<Role> roleList = null;
        try {
            roleList = roleMapper.findAll();
            if(roleList == null ){
                logger.error("RoleServiceImpl.findAll  查询角色信息为空   ！！");
                roleList = new ArrayList<Role>();
            }
        } catch (Exception e) {
//            e.printStackTrace();
            logger.error("RoleServiceImpl.findAll  查询角色信息异常   ！！");
            roleList = new ArrayList<Role>();
        }

        return roleList;
    }
}
